﻿<UserControl x:Class="XDraw.ToolboxPane"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:xdCore="clr-namespace:XDraw;assembly=XDraw2.Core"
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="250">

  <ListBox ItemsSource="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=UserControl}, Path=ToolboxItems}">
    <ListBox.ItemTemplate>
      <DataTemplate DataType="{x:Type xdCore:INewItemType}">
        <StackPanel Orientation="Horizontal" 
                    ToolTip="{Binding Path=Description}"
                    MouseLeftButtonDown="Item_MouseLeftButtonDown"
                    MouseLeftButtonUp="Item_MouseLeftButtonUp"
                    MouseMove="Item_MouseMove">
          
          <Image Source="{Binding Path=Icon}" Width="16" Height="16" Stretch="Uniform" Margin="0,1,3,1" VerticalAlignment="Center"/>
          <TextBlock Text="{Binding Path=Name}" Margin="3,1" VerticalAlignment="Center"/>
        </StackPanel>
      </DataTemplate>
    </ListBox.ItemTemplate>
  </ListBox>
</UserControl>
